/*
 * @Author: zhangzhengzhe
 * @Date: 2019-09-02 15:50:39
 * @LastEditors: zhangzhengzhe
 * @LastEditTime: 2019-09-03 11:41:11
 */

module.exports = {
  mongo: {
    devUrl: `mongodb://127.0.0.1/db_xa_shopee_chat_test`,
    url: `mongodb://190.168.0.17/db_xa_shopee_chat_test`,
  },
  port: 8008,
  corsOptions: {
    exposeHeaders: ['WWW-Authenticate', 'Server-Authorization', 'Date'],
    maxAge: 100,
    credentials: true,
    allowMethods: ['GET', 'POST', 'OPTIONS'],
    allowHeaders: ['Content-Type', 'Authorization', 'Accept', 'X-Custom-Header', 'anonymous'],
  },
  corsBodyParser: {
    // encoding: 'gzip, deflate, br',
    multipart: true,
    strict: false,
    patchKoa: true,
    patchNode: true,
    urlencoded: true,
    formidable: {
      multipart: true,
      // uploadDir: path.join(__dirname,'public/upload/'), // 设置文件上传目录
      keepExtensions: true, // 保持文件的后缀
      maxFieldsSize: 2097152, // 文件上传大小 2 * 1024 * 1024
      onFileBegin: (name, file) => { // 文件上传前的设置
        // console.log(file)
      }
    },
    onError: err => {
      console.log(err)
    }
  }
}